﻿using System;

class Subset
{
    static void Main()
    {
        //Exercise 9.
        //We are given 5 integer numbers. Write a program that checks if the sum of some subset of them is 0. 
        //Example: 3, -2, 1, 1, 8 -> 1+1-2=0.

        Console.Write("Enter integer number a:  ");
        int a = int.Parse(Console.ReadLine());
        Console.Write("Enter integer number b:  ");
        int b = int.Parse(Console.ReadLine());
        Console.Write("Enter integer number c:  ");
        int c = int.Parse(Console.ReadLine());
        Console.Write("Enter integer number d:  ");
        int d = int.Parse(Console.ReadLine());
        Console.Write("Enter integer number e:  ");
        int e = int.Parse(Console.ReadLine());

        if (a + b + c == 0)
        {
            Console.WriteLine("The sum of {0} + {1} + {2} is 0.", a, b, c);
        }
        else
        {
            if (a + b + d == 0)
            {
               Console.WriteLine("The sum of {0} + {1} + {2} is 0.", a, b, d); 
            }
            else if (a + b + e == 0)
            {
                Console.WriteLine("The sum of {0} + {1} + {2} is 0.", a, b, e);
            }
        }


        if (b + c + d == 0)
        {
            Console.WriteLine("The sum of {0} + {1} + {2} is 0.", b, c, d);
        }
        else if (b + c + e == 0)
        {
            Console.WriteLine("The sum of {0} + {1} + {2} is 0.", b, c, e);
        }


        if (c + d + e == 0)
        {
            Console.WriteLine("The sum of {0} + {1} + {2} is 0.", c, d, e);
        }
        else if (c + d + a == 0)
        {
            Console.WriteLine("The sum of {0} + {1} + {2} is 0.", c, d, a);
        }


        if (d + e + a == 0)
        {
            Console.WriteLine("The sum of {0} + {1} + {2} is 0.", d, e, a);
        }
        else if (d + e + b == 0)
        {
            Console.WriteLine("The sum of {0} + {1} + {2} is 0.", d, e, b);
        }

        else if (a + c + e == 0)
        {
            Console.WriteLine("The sum of {0} + {1} + {2} is 0.", a, c, e);
        }
        

        if (a + b + c + d == 0)
        {
            Console.WriteLine("The sum of {0} + {1} + {2} + {3} is 0.", a, b, c, d);
        }
        else
        {
            if (a + b + c + e == 0)
            {
                Console.WriteLine("The sum of {0} + {1} + {2} + {3} is 0.", a, b, c, e);
            }
            else
            {
                if (b + c + d + e == 0)
                {
                    Console.WriteLine("The sum of {0} + {1} + {2} + {3} is 0.", b, c, d, e);
                }
                else
                {
                    if (a + b + d + e == 0)
                    {
                        Console.WriteLine("The sum of {0} + {1} + {2} + {3} is 0.", a, b, d, e);
                    }
                    else
                    {
                        if (a + c + d + e == 0)
                        {
                            Console.WriteLine("The sum of {0} + {1} + {2} + {3} is 0.", a, c, d, e);
                        }
                    }
                }
            }
        }


        if (a + b == 0)
        {
            Console.WriteLine("The sum of {0} + {1} is 0.", a, b);
        }
        else
        {
            if (a + c == 0)
            {
                Console.WriteLine("The sum of {0} + {1} is 0.", a, c);
            }
            else
            {
                if (a + d == 0)
                {
                    Console.WriteLine("The sum of {0} + {1} is 0.", a, d);
                }
                else
                {
                    if (a + e == 0)
                    {
                        Console.WriteLine("The sum of {0} + {1} is 0.", a, e);
                    }
                    else
                    {
                        if (b + c == 0)
                        {
                            Console.WriteLine("The sum of {0} + {1} is 0.", b, c);
                        }
                        else
                        {
                            if (b + d == 0)
                            {
                                Console.WriteLine("The sum of {0} + {1} is 0.", b, d);
                            }
                            else
                            {
                                if (b + e == 0)
                                {
                                    Console.WriteLine("The sum of {0} + {1} is 0.", b, e);
                                }
                                else
                                {
                                    if (c + d == 0)
                                    {
                                        Console.WriteLine("The sum of {0} + {1} is 0.", c, d);
                                    }
                                    else
                                    {
                                        if (c + e == 0)
                                        {
                                            Console.WriteLine("The sum of {0} + {1} is 0.", c, e);
                                        }
                                        else
                                        {
                                            if (d + e == 0)
                                            {
                                                Console.WriteLine("The sum of {0} + {1} is 0.", d, e);
                                            }                                           
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        
        Console.WriteLine();
    }
}

